<% 
	var headContent = {
	include("/pages/template/head.html"){}
%>

<script type="text/javascript">
var oper;
jQuery(function($) {
	// 页面方法
	oper = {
		width : 400,
		height : 320,
		form : document.form1,
		list : function() {
			var url = 'dict/list';
			this.form.action = url;
			this.form.submit();
		},
		view : function(id) {
			var url = 'dict/view/'+id;
			var title = '查看数据字典';
			Iframe(url, this.width, this.height, title, false, false, false, EmptyFunc);
		},
		add : function() {
			var url = 'dict/add?dict_type='+form1["attr.dict_type"].value;
			var title = '添加数据字典';
			Iframe(url, this.width, this.height, title);
		},
		edit : function(id) {
			var url = 'dict/edit/'+id + '?dict_type='+form1["attr.dict_type"].value;
			var title = '修改数据字典';
			Iframe(url, this.width, this.height, title);
		},
		del : function(id) {
			var url = 'dict/delete/'+id;
			var title = '确认要删除该数据字典信息？';
			Confirm(title, function() {
				form1.action = url;
				form1.submit();
			});
		}
		,edit_dict : function(){
			var url = 'dict/edit_dict/'+$('[name="attr.dict_type"]').val();
			Iframe(url,350,250,'类型操作');
		}
	};
	//显示Menu索引
	showMenu('page_system');
	showMenu('page_dict');
});


</script>

<%
};

var bodyContent = {
%>
<form name="form1" action="" method="post" class="form-inline" role="form">
	<!-- 菜单 -->
	<% include("/static/component/include/menu.html"){} %>
	
	<div class="tableSearch">
		<div class="form-group">
		   <label  class="control-label">类型</label>
		   <select name="attr.dict_type" class="form-control" style="width: 140px;">
					<option value="">请选择</option> ${optionList }
			</select> 
		</div>
		<button type="button" class="btn btn-default" onclick="oper.list();" name="search">
		 		<span class="glyphicon glyphicon-search"></span> 查 询
		</button>
		<button type="button" class="btn btn-default" onclick="resetForm();">
		 		<span class="glyphicon glyphicon-refresh"></span> 重 置
		</button>
		<button type="button" class="btn btn-default" onclick="oper.add();">
		 		<span class="glyphicon glyphicon-plus"></span> 新 增
		</button>	
		<button type="button" class="btn btn-default" onclick="oper.edit_dict();">
		 		<span class="glyphicon glyphicon-edit"></span> 操作类型
		</button>
	</div>
	
	<!-- 数据列表 -->
	<table class="table table-striped table-bordered table-hover">
		<thead>
			<tr>
				<th>序号</th>
				<th>类型</th>
				<th>名称</th>
				<th>编号</th>
				<th>排序号</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
		<% for(item in page.list) { %>
			<tr>
				<td>${itemLP.index }</td>
				<td>${item.dict_name}</td>
				<td>${item.detail_name}</td>
				<td>${item.detail_code}</td>
				<td>${item.detail_sort}</td>
				<td>
					<a href="javascript:void(0);" class="btn btn-sm btn-success" onclick="oper.view(${item.detail_id});">查看</a> 
					<a href="javascript:void(0);" class="btn btn-sm btn-primary" onclick="oper.edit(${item.detail_id});">修改</a> 
					<a href="javascript:void(0);" class="btn btn-sm btn-danger" onclick="oper.del(${item.detail_id});">删除</a></td>
				</td>
			</tr>
		<% } %>
		</tbody>
	</table>
	<%include("/static/component/include/paginator.html"){} %>
</form>

<%}; %>


<% layout("/pages/template/_layout.html",{head:headContent,body:bodyContent}){ %>
<%} %>
